<script type="text/javascript">
$(document).ready(function()
				{
				$(".text").blur(function(){
											$cellvalue = $(".cellvalue").val();
											$tong =$('.tong'+$(this).get(0).id).val();
											$value=$(this).val();
											$cellvalue = parseInt($cellvalue,10);
											$tong =parseInt($tong,10);
											$value=parseInt($value,10);
											if (isNaN($cellvalue))
												$cellvalue=0;
											if (isNaN($tong))
												$tong=0;
											if (isNaN($value))
											{
												$value=0;
												$(this).val(0);
											}
											$tong = $tong + $value - $cellvalue;
											$('.tong'+$(this).get(0).id).val($tong);
										});

				$(".text").focus(function(){
					$(".cellvalue").val($(this).val());
				});
				
				$(".text").keydown(function(e) {
					arr_key = new Array();
					arr_key[8]=8;
					arr_key[9]=9;
					arr_key[35]=35;
					arr_key[36]=36;
					arr_key[37]=37;
					arr_key[39]=39;
					arr_key[46]=46;
			        if ( arr_key[e.keyCode]!==undefined) {}
			        else {
			            if (e.keyCode < 48 || e.keyCode > 57 ) {
			                e.preventDefault(); 
			            }   
			        }
			    });
				}
	);

</script>
<?php

	if (count($chitieus)!=0 && count($kenhs)!=0&& count($loaikenhs)!=0 && count($data)!=0 && count($data_id))
	{
		echo $form->create('Kqbanhang',array('url'=>array('controller'=>'kqbanhangs','action'=>'luukq',$nhanvien_id)));
		echo $ctable->edittable_2('Kqbanhang',$kenhs, $chitieus,$loaikenhs, $data,$data_id);
		echo $form->end('  Lưu  ');
	}
 
    
    
  ?>
 <div class="khfiles">
<?php echo $this->Form->create('Upfile',array('type'=>'file','controller'=>'upfiles','action'=>'add'));?>
	
 
    <table border="0" cellpadding="0" cellspacing="0" style="border: 2px solid #b9c9fe;
            margin-left: auto; margin-right: auto; margin-top:20px; padding: 7px 7px 4px 7px; background-color: #fafafa;">
            <tr><td>Ghi chú</td><td>	<?php
	echo $this->Form->input('ghichu',array('label'=>false,'type'=>'textarea'));
?></td>
            </tr>
    			<tr>
    				<td style="padding: 0x 5px 0px 5px"><b>Chọn đường dẫn tập tin</b></td>
    				<td style="padding: 0x 5px 0px 5px">
    					<?php
    						echo $fileUpload->input(array('var'=>'file', 'model'=>'Upfile', 'label' => false));
                         //   echo $fileUpload->input('file'); 
    					?>
    				</td>
    			</tr>
    			<tr>
                    <td></td>
    				<td colspan="2" align="left" >
                        <input type="submit" name="Submit" value="Lưu và Tải lên"/>			
                       
    				</td>
    			</tr>
</table>
</div>  